<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>learn react</title>
    <script src="js/react.js"></script>
    <script src="js/react-dom.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script>
  </head>
  <body>
    <div id="example"></div>
    <script type="text/babel">
    /*
      change 事件  
     */
      var Input = React.createClass({
        getInitialState: function() {
          return {value: 'Hello'}
        },
        handleChange: function(event) {
          this.setState({value: event.target.value})
        },
        render: function() {
          var value = this.state.value
          return (
            <div>
              <input type='text' value={value} onChange = {this.handleChange} />
              {value}
            </div>
          )
        }
      })
      ReactDOM.render(
        <Input />,
        document.getElementById('example')
      )
    </script>
  </body>
</html>
